package com.jbh.wanandroidkotlin.view

import android.content.Context
import android.graphics.Canvas
import android.util.AttributeSet
import android.widget.Button
import android.widget.LinearLayout

class MyView : LinearLayout {

    constructor(context : Context):this(context,null){
    }
    constructor(context: Context, attrs: AttributeSet?): this(context,attrs!!,0){
    }

    constructor(context : Context, attrs: AttributeSet, defStyleAttr:Int): super(context,attrs,defStyleAttr){
        val btn = Button(context)
        btn.text = "多發點"
        addView(btn)
    }

    override fun onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int) {
        super.onLayout(changed, l, t, r, b)
    }

    override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec)
    }

    override fun onDraw(canvas: Canvas?) {
        super.onDraw(canvas)
    }
}